<layout name="Iflayout"/>

    <script type="text/javascript">
        $(function(){
            $('.btn-click-show').click(function(event) {
                /* Act on the event */
                var iUrl = $(this).attr('data-href');
                if (iUrl.length > 0) {

                    layer.open({
                        type: 2,
                        title: 'XYHCMS',
                        shadeClose: true,
                        shade: false,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['700px', '500px'],
                        content: iUrl
                    });

                }
            });

        })

    </script>
<div class="xyh-content">

    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em>
                广告位列表
            </h3>
        </div>

    </div>

    <div class="row margin-botton">
        <div class="col-sm-6 column">
            <div class="btn-group btn-group-md">
                <button class="btn btn-primary" type="button" onclick="goUrl('add')"><em class="glyphicon glyphicon-plus-sign"></em> 添加广告位</button>
            </div>
        </div>
        <div class="col-sm-6 text-right">
            <form class="form-inline" method="post" action="">
                <div class="form-group">
                    <label class="sr-only" for="inputKeyword">关键字</label>
                    <input type="text" class="form-control" name="keyword" id="inputKeyword" placeholder="关键字" value="{$key}">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <form action="" method="post" id="form_do" name="form_do">
                <div class="table-responsive">
                    <table class="table table-hover xyh-table-bordered-out">
                        <thead>
                        <tr class="active">
                            <th>编号</th>
                            <th>广告位</th>
                            <th>类型</th>
                            <th>尺寸</th>
                            <th>广告数</th>
                            <th class="text-right">操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <foreach name="list" item="arr">
                            <tr>
                                <td>{$arr['id']}</td>
                                <td><a href="{:U('label',array('id'=>$arr['id']))}">{$arr['name']}[{$arr['remark']}]</a></td>
                                <td>{$arr['names']}</td>
                                <td>{$arr['width']}x{$arr['height']}</td>
                                <td>{$arr['num']}</td>
                                <td class="text-right">
                                    <a href="javascript:;" data-href="/xyhai.php?s=/Abc/getcode/id/2" class="label label-info btn-click-show">获取代码</a>
                                    <a href="{:U('label',array('id'=>$arr['id']))}" class="label label-primary">广告列表</a>
                                    <a href="{:U('edit',array('id'=>$arr['id']))}" class="label label-success">编辑</a>
                                    <a href="javascript:void(0)"  m="{$arr['id']}" class="label label-danger">删除</a>
                                    <a href="{:U('addDetail',array('id'=>$arr['id']))}" class="label label-info">添加广告</a>
                                </td>
                            </tr>
                        </foreach>

                        </tbody>
                    </table>
                </div>
            </form>

            <div class="row clearfix">
                <div class="col-md-12 column">
                    <div class="xyh-page">
                        <div><span class="rows">共{$count}条记录</span></div>
                        <div>{$page}</div>
                    </div>
                </div>
            </div>


        </div>
    </div>

</div>
</body>
</html>
<script>
    $(function(){

        $('.label-danger').click(function(){

            if(confirm('确定删除?')){

                var _id = $(this).attr('m');

                var _this = $(this);

                $.post("{:U('del')}", {id:_id}, function(data){

                    if(data){

                        alert('删除成功');

                        _this.parent().parent().remove();

                    }else{

                        alert('删除失败');
                    }

                })

            }

        })

    })
</script>
